package com.neusoft.yiyang.medical.controller;

import com.neusoft.yiyang.common.entity.medical.CareLevelSuggestion;
import com.neusoft.yiyang.medical.service.CareLevelSuggestionService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@Tag(name = "护理级别建议接口", description = "管理医疗人员对客户护理级别的建议及相关操作")
@RestController
@RequestMapping("/care-level-suggestions")
public class CareLevelSuggestionController {

    @Autowired
    private CareLevelSuggestionService careLevelSuggestionService;

    @Operation(summary = "创建护理级别建议", description = "医疗人员为客户提交护理级别建议（含建议级别、依据等）")
    @PostMapping("/create")
    public void createCareLevelSuggestion(
            @Parameter(description = "护理级别建议信息（含客户ID、建议级别ID、医疗人员ID等）", required = true)
            @RequestBody CareLevelSuggestion careLevelSuggestion) {
        careLevelSuggestionService.createCareLevelSuggestion(careLevelSuggestion);
    }

    @Operation(summary = "获取所有护理级别建议", description = "查询系统中所有的护理级别建议记录")
    @GetMapping("/all")
    public List<CareLevelSuggestion> getAllCareLevelSuggestions() {
        return careLevelSuggestionService.getAllCareLevelSuggestions();
    }

    @Operation(summary = "查询客户的护理级别建议", description = "获取指定客户的所有护理级别建议记录")
    @GetMapping("/customer/{customerId}")
    public List<CareLevelSuggestion> getCareLevelSuggestionsByCustomerId(
            @Parameter(description = "客户ID", required = true)
            @PathVariable Integer customerId) {
        return careLevelSuggestionService.getCareLevelSuggestionsByCustomerId(customerId);
    }

    @Operation(summary = "更新护理级别建议", description = "修改指定客户的护理级别建议信息")
    @PostMapping("/update/{customerId}")
    public void updateCareLevelSuggestion(
            @Parameter(description = "客户ID", required = true)
            @PathVariable Integer customerId,
            @Parameter(description = "建议的护理级别ID", required = true)
            @RequestParam Integer suggestedLevelId,
            @Parameter(description = "操作的医疗人员ID", required = true)
            @RequestParam Integer medicalStaffId
    ) {
        careLevelSuggestionService.updateCareLevelSuggestion(customerId, suggestedLevelId, medicalStaffId);
    }

    @Operation(summary = "删除护理级别建议", description = "移除指定的护理级别建议记录")
    @DeleteMapping("/delete/{suggestionId}")
    public void deleteCareLevelSuggestion(
            @Parameter(description = "护理级别建议ID", required = true)
            @PathVariable Integer suggestionId) {
        careLevelSuggestionService.deleteCareLevelSuggestion(suggestionId);
    }
}